<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加小班信息</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="" >
    <div class="layui-container " style="margin-top: 5px" >
        <div class="layui-row ">
            <div class="layui-col-md4">

                <div class="layui-form-item">
                    <label class="layui-form-label">小班名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="className" required  lay-verify="required"  autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">负责人</label>
                    <div class="layui-input-block">
                        <input type="text" name="managerPeople" required  lay-verify="required"  autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">负责人电话</label>
                    <div class="layui-input-block">
                        <input type="text" name="tel" required  lay-verify="required"  autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">人员数量</label>
                    <div class="layui-input-block">
                        <input type="text" name="number" required  lay-verify="required"  autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">负责区域</label>
                    <div class="layui-input-block">
                        <select name="areaName" lay-verify="required" id="areaName">

                        </select>
                    </div>
                </div>

            </div>
        </div>
    </div>
</form>
</body>
<script src="../layui/layui.js"></script>
<script>
    layui.use(["table","jquery","form"],function () {
        let table = layui.table;
        let $ = layui.$;
        let form = layui.form;
        let html = "<option value=''>请选择</option>";

        $.ajax({
            type:"get",
            url:"/MyForestManagerSystem/as.do?method=queryAreaList",
            dataType:"json",
            success:function (data) {
                for(let i = 0 ;i<data.length;i++){
                    html += "<option value="+data[i].areaId+">"+data[i].areaName+"</option>";
                }
                $("#areaName").html(html);
                form.render("select");
            }
        })
    })
</script>
</html>